<?php

namespace app\admin\controller;

use app\common\model\Group as GroupModel;
use app\common\controller\AdminController;
use app\common\service\annotation\ControllerAnnotation;
use think\App;

/**
 * @ControllerAnnotation(title="集团管理")
 */
class Group extends AdminController
{
    public function __construct(App $app)
    {
        parent::__construct($app);
        $this->model          = new GroupModel();
//        $this->relationSearch = true;
        $this->joinTable      = 'company,user';
        $this->each  = true;
    }

    public function each($list)
    {
        return $list->each(function ($item) {
            $item->user = $item->user()->select();
            $item->company = $item->company()->select();
        });
    }

}